package edu.ipccenter.toster;

import java.math.BigInteger;

public class Name implements Comparable<Name> {
	private BigInteger id;
	private String name;
	
	public BigInteger getID() {
		return id;
	}
	
	public void setID(BigInteger id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@Override
	public int compareTo(Name n) {
		int result;
		
		if (id.equals(n.getID()))
			return 0;
		
		result = name.compareTo(n.getName());
		
		return (result != 0) ? result : id.compareTo(n.getID());
	}
	
	public boolean equals(Name n) {
		return id.equals(n.getID());
	}
	
	@Override
	public int hashCode() {
		return id.hashCode();
	}
}
